<?php
/* @var $this SmsordersController */
/* @var $model Smsorders */

$this->breadcrumbs=array(
	'Smsorders'=>array('index'),
	'Manage',
); 

if(Yii::app()->user->name=="admin"){ 
	   $buttoncolumn ='{view}';
	   $showpoint='';
    }else{
	     $this->menu=array(
			array('label'=>'路由器信息', 'url'=>array('admin')),
	     );  
	    $buttoncolumn ='{view}{pay}';
	    $showpoint='<span class="smscount">当前短信剩余：<span class="candara">'.$showpoints.'</span> 条</span>';
    } 

?> 
<script type="text/javascript">
   $(document).ready(function(e) {
		$(".repay").click(function(){ 
			var pid =$(this).attr('href'); 
			window.open('<?php echo Yii::app()->createUrl("alipay/index&id=");?>'+pid);  
		} );

		$(".repay").colorbox({
			href:"<?php echo Yii::app()->createUrl('company/mask');?>",
			close: "【关闭】",
			initialWidth:400,
			initialHeight:260,
			width:'400px',
			height:'260px',
			overlayClose:false,
			title:"支付等待" 
		}); 
	});  
    
	 
   function succeed(){
       location.reload();
   }
   function failure(){ 
   }
//Yii::app()->createUrl("alipay/index", array("id"=>$data->id))
</script>

<h1>短信充值记录 <?php echo $showpoint;?></h1>  

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'smsorders-grid',
	'dataProvider'=>$model->search(),
	//'filter'=>$model,
	'enableHistory'=>true,
    'template'=>"{items}{summary}{pager}",
    'summaryText'=>'每页显示10条,共{count}条',
    'summaryCssClass'=>'summaryinfo',
    'emptyText'=>'没有数据',
    'itemsCssClass'=>'itemsinfo',
    'pager'=>array(
        'class'=>'CLinkPager',
        'header'=>'',
        'nextPageLabel'=>'下一页',
        'prevPageLabel'=>'上一页',
        'firstPageLabel'=>'首页',
        'lastPageLabel'=>'尾页', 
        ),
	'columns'=>array(
		array(  
            'header' => '序号',  
            'value' => '$this->grid->dataProvider->getPagination()->getOffset()+($row+1)', //CDataColumn $this->grid  
            'htmlOptions' => array(  
                'width' => '40px',  
                "style"=> 'text-align:center',
            ),  
        ),  
		'orderno',
		array(
            'name'=>'totalfee',
            'value'=>'$data->totalfee."元"', 
        ),   
		'subject',
		'status',
		// 'orderbody',  
		// 'smscount',
		array(
            'name'=>'createtime',
            'value'=>'date("Y-m-d H:i",strtotime($data->createtime));', 
        ),  
		array(
			'class'=>'CButtonColumn',
			'header' => '操作', //指明头信息  
			'template'=> $buttoncolumn,  
            'buttons' =>array(     
                'pay' => array(    
                    'label'=>'重新支付',    
                    'imageUrl'=>Yii::app()->request->baseUrl.'/images/admin/xuanz.png', 
                    'visible'=>'$data->status == "支付中" ',   
                    'url'=>'$data->id',  
                    'options'=>array('class'=>'repay'),
                ),
                 'view' => array(    
                    'label'=>'显示',    
                    'imageUrl'=>Yii::app()->request->baseUrl.'/images/admin/caz.png',   
                ),  
            ),  
		),
	),
)); ?>
